<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"           
                xmlns:ca="http://java.sun.com/jsf/composite/cashier"
                xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"
                xmlns:pe="http://primefaces.org/ui/extensions">


    <ui:define name="content">

        <h:panelGroup rendered="true" >
            <h:form>
                <h:outputStylesheet library="css" name="printing.css"></h:outputStylesheet>
                <p:panel id="reportPrint" styleClass="noBorder summeryBorder">

                    <p:panel>
                        <f:facet name="header" >
                            <h:outputLabel value="#{commonReport.webUser.institution.name}"/><br/>
                            <h:outputLabel value="#{commonReport.webUser.webUserPerson.name}"/>
                            <h:outputLabel value="  Casheir Session Report"/>
                            <p:commandButton id="btnRefresh" ajax="false" value="Refresh" styleClass="noPrintButton" style="float: right;" action="#{commonReport.createCashierTableByUser()}" />  
                            <p:defaultCommand target="btnRefresh"/>

                            <p:commandButton actionListener="#{commonReport.createCashierTableByUser()}" ajax="false" value="Excel" styleClass="noPrintButton" style="float: right;" >
                                <pe:exporter type="xlsx" target="sum1,sum2,sum11,sum22" fileName="All_Cashier_Summery"   />
                            </p:commandButton> 

                            <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" style="float: right;" >
                                <p:printer target="reportPrint"  />
                            </p:commandButton>
                        </f:facet>


                        <h:panelGrid columns="6" styleClass="noPrintButton" >
                            <h:outputLabel value="From Date"/>
                            <p:calendar id="frmDate" value="#{commonReport.fromDate}" navigator="true"  pattern="dd MMMM yyyy HH:mm:ss" >
                            </p:calendar>

                            <h:outputLabel value="To Date"/>
                            <p:calendar id="toDate" value="#{commonReport.toDate}" navigator="true" pattern="dd MMMM yyyy HH:mm:ss" >
                            </p:calendar>
                            <h:outputLabel styleClass="noPrintButton" value="User Name"/>
                            <p:autoComplete converter="webUs" completeMethod="#{webUserController.completeUser}" styleClass="noPrintButton"
                                            forceSelection="true"
                                            var="w" itemLabel="#{w.webUserPerson.name}" itemValue="#{w}"
                                            value="#{commonReport.webUser}" ></p:autoComplete>

                        </h:panelGrid>

                        <h:panelGrid columns="4" styleClass="printBlock"  style="min-width: 100%!important;">

                            <h:outputLabel value="From Date " />
                            <h:outputLabel  value="#{commonReport.fromDate}" >
                                <f:convertDateTime pattern="dd MMMM yyyy"/>
                            </h:outputLabel>
                            <h:outputLabel value="To Date" />
                            <h:outputLabel  value="#{commonReport.toDate}" >
                                <f:convertDateTime pattern="dd MMMM yyyy"/>
                            </h:outputLabel>

                            <h:outputLabel value="From Time " />
                            <h:outputLabel  value="#{commonReport.fromDate}" >
                                <f:convertDateTime pattern="HH:mm a"/>
                            </h:outputLabel>
                            <h:outputLabel value="To Time " />
                            <h:outputLabel  value="#{commonReport.toDate}" >
                                <f:convertDateTime pattern="HH:mm a"/>
                            </h:outputLabel>
                        </h:panelGrid>

                        <ca:opdBilledSummery data="#{commonReport.userBillsOwn}"/>

                        <p:spacer height="30"/>

                        <ca:opdCancelled data="#{commonReport.userCancelledBillsOwn}"/>

                        <p:spacer height="30"/>

                        <ca:opdRefunded data="#{commonReport.userRefundedBillsOwn}"/>

                        <p:spacer height="30"/>

                        <ca:pharmacyBilledSummery data="#{commonReport.userBillsOwnPh}"/>

                        <p:spacer height="30"/>

                        <ca:pharmacyCancelled data="#{commonReport.userCancelledBillsOwnPh}"  />

                        <p:spacer height="30"/>

                        <ca:phrmacyRefunded data="#{commonReport.userRefundedBillsOwnPh}"/>

                        <p:spacer height="30"/>

                        <ca:paymentBill data="#{commonReport.userPaymentBillsOwn}"/>

                        <p:spacer height="30"/>

                        <ca:paymentCancel data="#{commonReport.userPaymentCancelBillsOwn}"/>

                        <p:spacer height="30"/>

                        <ca:pettyBillSummery data="#{commonReport.userPettyPaymentBills}"/>

                        <p:spacer height="30"/>


                        <ca:pettyCancellSummery data="#{commonReport.userPettyPaymentCancelBills}" />

                        <p:spacer height="30"/>

                        <ca:companyBill data="#{commonReport.userCashRecieveBills}"/>

                        <p:spacer height="30"/>

                        <ca:campanyCancell data="#{commonReport.userCashRecieveBillCancel}"/>

                        <p:spacer height="30"/>

                        <ca:agentBill data="#{commonReport.userAgentRecieveBills}"/>

                        <p:spacer height="30"/>

                        <ca:agentCancel  data="#{commonReport.userAgentRecieveBillCancel}" />

                        <p:spacer height="30"/>

                        <ca:inwrdPaymentBill data="#{commonReport.userInwardPaymentBillsOwn}"/>

                        <p:spacer height="30"/>

                        <ca:inwardPaymentCancel data="#{commonReport.userInwardPaymentCancelBillsOwn}"/>

                        <p:spacer height="30"/>
                        #{commonReport.inwardRefunds.bills.size()}
                        <ca:inwrdRefundBill data="#{commonReport.inwardRefunds}"/>

                        <p:spacer height="30"/>


                        <p:dataTable id="sum1" value="#{commonReport.creditSlipSum}"  var="i" >
                            <f:facet name="header">
                                Credit Summary
                            </f:facet>
                            <p:column>
                                <h:outputLabel value="#{i.string}"/>
                            </p:column>
                            <p:column style="font-weight: bold;text-align:right;" >
                                <h:outputLabel value="#{i.value}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                            </p:column>
                        </p:dataTable>                

                        <p:spacer height="30"/>

                        <p:dataTable id="sum2" value="#{commonReport.cashChequeSum}"  var="i" >
                            <f:facet name="header">
                                <h:outputLabel value="Cash Summary"/>
                            </f:facet>
                            <p:column>
                                <h:outputLabel value="#{i.string}"/>
                            </p:column>
                            <p:column style="font-weight: bold;text-align:right;" >
                                <h:outputLabel value="#{i.value}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                            </p:column>
                        </p:dataTable>

                        <p:spacer height="30"/>

                        <h:panelGrid columns="1">
                            <h:outputLabel value="Cashier : #{commonReport.webUser.webUserPerson.name}"/>
                            <br/>
                            <h:outputLabel value="............................"/>
                        </h:panelGrid>
                    </p:panel>

                    <div style="page-break-after: always;">
                        <br/>
                    </div>

                    <p:panel>
                        <f:facet name="header"> 
                            <h:outputLabel value="#{commonReport.webUser.institution.name}"/><br/>
                            <h:outputLabel value="#{commonReport.webUser.webUserPerson.name}"/>
                            <h:outputLabel value="  Petty Cash Report"/>
                        </f:facet>
                        <h:panelGrid columns="4" styleClass="printBlock"  style="min-width: 100%!important;">
                            <h:outputLabel value="From Date " />
                            <h:outputLabel  value="#{commonReport.fromDate}" >
                                <f:convertDateTime pattern="dd MMMM yyyy"/>
                            </h:outputLabel>
                            <h:outputLabel value="To Date" />
                            <h:outputLabel  value="#{commonReport.toDate}" >
                                <f:convertDateTime pattern="dd MMMM yyyy"/>
                            </h:outputLabel>

                            <h:outputLabel value="From Time " />
                            <h:outputLabel  value="#{commonReport.fromDate}" >
                                <f:convertDateTime pattern="HH:mm a"/>
                            </h:outputLabel>
                            <h:outputLabel value="To Time " />
                            <h:outputLabel  value="#{commonReport.toDate}" >
                                <f:convertDateTime pattern="HH:mm a"/>
                            </h:outputLabel>
                        </h:panelGrid>

                        <ca:pettyBills data="#{commonReport.userPettyPaymentBills}"/>

                        <p:spacer height="30"/>

                        <ca:pettyCancel data="#{commonReport.userPettyPaymentCancelBills}"/>
                    </p:panel>


                    <div style="page-break-after: always;">
                        <br/>
                    </div>

                    <p:panel rendered="#{commonReport.userBillsPhOther.bills.size()!=0
                                         or commonReport.userCancelledBillsPhOther.bills.size()!=0
                                         or commonReport.userRefundedBillsPhOther.bills.size()!=0 }" >
                        <p:panel  >
                            <f:facet name="header"> 
                                <h:outputLabel value="#{commonReport.institution.name}"/><br/>
                                <h:outputLabel value="#{commonReport.webUser.webUserPerson.name}"/>
                                <h:outputLabel value="  Casheir Session Report"/>
                            </f:facet>

                            <h:panelGrid columns="4" styleClass="printBlock"  style="min-width: 100%!important;">                             
                                <h:outputLabel value="From Date " />
                                <h:outputLabel  value="#{commonReport.fromDate}" >
                                    <f:convertDateTime pattern="dd MMMM yyyy"/>
                                </h:outputLabel>
                                <h:outputLabel value="To Date" />
                                <h:outputLabel  value="#{commonReport.toDate}" >
                                    <f:convertDateTime pattern="dd MMMM yyyy"/>
                                </h:outputLabel>

                                <h:outputLabel value="From Time " />
                                <h:outputLabel  value="#{commonReport.fromDate}" >
                                    <f:convertDateTime pattern="HH:mm a"/>
                                </h:outputLabel>
                                <h:outputLabel value="To Time " />
                                <h:outputLabel  value="#{commonReport.toDate}" >
                                    <f:convertDateTime pattern="HH:mm a"/>
                                </h:outputLabel>
                            </h:panelGrid>

                            <p:spacer height="30"/>

                            <ca:pharmacyBilledSummery data="#{commonReport.userBillsPhOther}"/>

                            <p:spacer height="30"/>

                            <ca:pharmacyCancelled data="#{commonReport.userCancelledBillsPhOther}"  />

                            <p:spacer height="30"/>

                            <ca:phrmacyRefunded data="#{commonReport.userRefundedBillsPhOther}"/>

                            <p:dataTable id="sum11" value="#{commonReport.creditSlipSum2}"  var="i" >
                                <f:facet name="header">
                                    Credit Summary
                                </f:facet>
                                <p:column>
                                    <h:outputLabel value="#{i.string}"/>
                                </p:column>
                                <p:column style="font-weight: bold;text-align:right;" >
                                    <h:outputLabel value="#{i.value}">
                                        <f:convertNumber pattern="#,##0.00" />
                                    </h:outputLabel>
                                </p:column>
                            </p:dataTable>                


                            <p:spacer height="30"/>

                            <p:dataTable id="sum22" value="#{commonReport.cashChequeSum2}"  var="i" >
                                <f:facet name="header">
                                    <h:outputLabel value="Cash Summary"/>
                                </f:facet>
                                <p:column>
                                    <h:outputLabel value="#{i.string}"/>
                                </p:column>
                                <p:column style="font-weight: bold;text-align:right;" >
                                    <h:outputLabel value="#{i.value}">
                                        <f:convertNumber pattern="#,##0.00" />
                                    </h:outputLabel>
                                </p:column>
                            </p:dataTable>

                            <p:spacer height="30"/>

                            <h:panelGrid columns="1">
                                <h:outputLabel value="Cashier : #{commonReport.webUser.webUserPerson.name}"/>
                                <br/>
                                <h:outputLabel value="............................"/>
                            </h:panelGrid>

                        </p:panel>
                    </p:panel>
                </p:panel>
            </h:form>
        </h:panelGroup>
    </ui:define>

</ui:composition>
